<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../../include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>${fns:getConfig('productName')}后台登录</title>
<meta name="decorator" content="default" />
<link rel="stylesheet"
	href="${ctxStatic}/tp/bootstrap/2.3.1/css_default/bootstrap.min.css">
<link rel="stylesheet"
	href="${ctxStatic}/tp/bootstrap/2.3.1/css_default/bootstrap-responsive.min.css">
<link rel="stylesheet" href="${ctxStatic}/css/login/typica-login.css">
<style type="text/css">
.control-group {
	border-bottom: 0px;
}
</style>
<!--[if lt IE 9]>
	 <script src="${ctxStatic}/js/html5.js"></script>
    <![endif]-->
</head>
<body>
	<div class="navbar navbar-fixed-top">
		<div class="navbar-inner">
			<div class="container">
				<a class="btn btn-navbar" data-toggle="collapse"
					data-target=".nav-collapse"> <span class="icon-bar"></span> <span
					class="icon-bar"></span> <span class="icon-bar"></span>
				</a> <a class="brand" href="${ctx}"><img
					src="${ctxStatic }/images/logo_white.png" alt="ehuo" style="height: 40px;"></a>
			</div>
		</div>
	</div>

	<div class="container">
		<!--[if lte IE 6]><br/>
		<div class='alert alert-block' style="text-align:left;padding-bottom:10px;">
		<a class="close" data-dismiss="alert">x</a><h4>温馨提示：</h4>
			<p>你使用的浏览器版本过低。为了获得更好的浏览体验，我们强烈建议您 <a href="http://browsehappy.com" target="_blank">升级</a>
			 到最新版本的IE浏览器，或者使用较新版本的 Chrome、Firefox、Safari 等。</p></div><![endif]-->
		<%String error = (String) request.getAttribute("message");%>
		<div id="messageBox" class="alert alert-error <%=error==null?"hide":""%>"><button data-dismiss="alert" class="close">×</button>
			<label id="loginError" class="error"><%=error==null?"":error %></label>
		</div>
		<div id="login-wraper">
			<form id="loginForm" class="form login-form"
				action="${ctx}/autoinn/wxfacilitator/login" method="post">
				<fieldset>
					<legend>
						<span style="color: #08c;">服务商系统登陆</span>
					</legend>
				</fieldset>
				<div class="body">
					<div class="control-group">
						<div class="controls">
							<input type="text" id="username" name="account" class="required" value="" placeholder="登录名">
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<input type="password" id="password" name="passwd"  class="required" placeholder="密码" />
						</div>
					</div>

					<div class="validateCode">
						<!-- <label for="validateCode" style="display: inline-block">验证码：</label>  -->
						<input type="text" id="validateCode" name="captcha" maxlength="5" class="txt required" 
						style="font-weight:bold;width:45px;margin-bottom:0;">
						<img src="${ctx}/getCaptcha" onclick="$('.validateCodeRefresh').click();" class="mid validateCode">
						<a href="javascript:" onclick="$('.validateCode').attr('src','${ctx}/getCaptcha?date='+new Date().getTime());" class="mid validateCodeRefresh">看不清</a> 
					</div>
				</div>
				<div class="footer">
					<label class="checkbox inline"> <input type="checkbox"
						id="rememberMe" name="rememberMe"> <span
						style="color: #08c;">记住我</span>
					</label> <input class="btn btn-primary" type="submit" value="登 录" />
				</div>
			</form>
		</div>
	</div>
	<footer class="white navbar-fixed-bottom">
		Copyright &copy; 2012-${fns:getConfig('copyrightYear')} <a
			href="${ctx}${fns:getFrontPath()}">${fns:getConfig('productName')}</a>
		${fns:getConfig('version')}
	</footer>

	<!-- js -->
	<script src="${ctxStatic}/js/jquery-1.8.3.min.js"></script>
	<script src="${ctxStatic}/js/backstretch.min.js"></script>
	<script src="${ctxStatic}/tp/bootstrap/2.3.1/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(document).ready(
				function() {
					$.backstretch([ "${ctxStatic}/images/login/bg1.jpg",
							"${ctxStatic}/images/login/bg2.jpg",
							"${ctxStatic}/images/login/bg3.jpg" ], {
						duration : 10000,
						fade : 2000
					});

					$("#loginForm").validate({
						rules : {
							validateCode : {
								remote : "${ctx}/getCaptcha"
							}
						},
						messages : {
							username : {
								required : "请填写用户名."
							},
							password : {
								required : "请填写密码."
							},
							validateCode : {
								remote : "验证码不正确.",
								required : "请填写验证码."
							}
						},
						errorLabelContainer : "#messageBox",
						errorPlacement : function(error, element) {
							error.appendTo($("#loginError").parent());
						}
					});
				});
		// 如果在框架中，则跳转刷新上级页面
		 if (self.frameElement && self.frameElement.tagName == "IFRAME") {
			var top = getTopWinow(); // 获取当前页面的顶层窗口对象
			top.location.href="${ctx}${fns:getAdminPath()}/logout";
		} 
		
		
		 function getTopWinow() {
			var p = window;
			while (p != p.parent) {
				p = p.parent;
			}
			return p;
		}   
		
		
	</script>
	
	
</body>
</html>